<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象的增强</title>
</head>
<body>

</body>
<script>
    //es5
    const person = {
        //放 键值对
        name:"shane",
        age: 12,
        run:function(){}
    }
    console.log(person);

    //es6简写
    let name = "Kitty"
    const person2 = {
        name,
        age,
        run(){}
    }
    console.log(person2);

    //对象属性的表达式，通过表达式创建属性
    obj = {
        [name+'Newname']:'Amy',
        [name+'Newage']:15
    }
    console.log(obj);

    //...扩展运算符
    obj2 = {
        name:'tom'
    }
    obj3 = {
        say(){}
    }

    //对象合并
    console.log({...obj,...obj2,...obj3})

    //Object.assign(target,source) 将对象复制到面板对象中
    Object.assign(obj3,obj2)
    console.log(obj3)
</script>
</html>